package com.navinfo.platform.trip.common.arithmetic;

import com.navinfo.platform.trip.common.arithmetic.data.OuterStatisticData;
import com.navinfo.platform.trip.common.arithmetic.var.VarCommon;
import com.navinfo.platform.trip.common.arithmetic.enums.EventType;
import com.navinfo.platform.trip.common.arithmetic.manager.AbstractArithmetic;

/**
 * 实时计算：单独0200算法链的弯道超速算法<br/>
 * 输出：事件<br/>
 * @author 沈东生
 */
public class SpeedOverCurve_0200 extends AbstractArithmetic<VarCommon> {
    /**
     * 事件类型
     */
    private static final EventType EVENT_TYPE = EventType.speedOverCurve_0200;

    @Override
    public void calculate() {
        logger.debug("进入0200弯道超速报警算法.[terminalId:{}]", terminalId);

        boolean preStatus = drivingData.getEventData().containsKey(EVENT_TYPE);
        boolean curStatus = getCommonData().isCurve();

        switch (super.getEventStatus(preStatus, curStatus)) {
            case START:
                logger.debug("0200弯道超速报警算法，事件开始.[terminalId:{}]", terminalId);
                startEventData(EVENT_TYPE);
                break;
            case IN:
                logger.debug("0200弯道超速报警算法，事件中.[terminalId:{}]", terminalId);
                calcEventData(EVENT_TYPE);
                break;
            case END:
                logger.debug(" 弯道超速报警算法，事件结束.[terminalId:{}]", terminalId);
                calcEventData(EVENT_TYPE);
                endEventData(EVENT_TYPE);
                break;
            default:
                logger.debug(" 弯道超速报警算法，上一次和本次都弯道超速，不进行计算.[terminalId:{}]", terminalId);
        }
    }

    @Override
    public void collect(OuterStatisticData statisticDataOut) {
        
    }
}
